/**
	Constructs a 

	@author Matthew Richmond
	@version 2006-09-19
	@copyright (c) 2006 The Chopping Block, Inc.. All rights reserved.

	@usage

	- Activate with:
	<code>

	</code>

*/
import timber.ui.ProgressIndicator;

class CustomProgressIndicator extends ProgressIndicator{

	private var currentTotal:Number;
	private var currentLoaded:Number;
	
	private var bar_mc:MovieClip;
	private var display_txt:TextField;

// ===========================================================
// - CONSTRUCTOR
// ===========================================================

	function CustomProgressIndicator () {
		trace("CustomProgressIndicator");
	};

	function init (){
		trace("init");
		bar_mc._xscale = 0;
	};

	function setTotal (bytesTotal:Number){
		//trace("setTotal");
		currentTotal = bytesTotal;
	};

	function setValue (bytesLoaded:Number){
		//trace("setValue");
		currentLoaded = bytesLoaded;
	};

	function update (){
		//trace("update");
		bar_mc._xscale = getPercent ();
		display_txt.text = getPercent().toString() + "% loaded";
	};
	
// ===========================================================
// - ACCESSOR
// ===========================================================
	
	function getPercent ():Number{
		//trace("getPercent");
		return Math.round((currentLoaded/currentTotal)*100);
	};

};